﻿@using MyData.Dto
@model SystemConfigDto
@{
    ViewBag.Title = "系统设置";
    Layout = "~/Views/Shared/_Index.cshtml";
}
@*<link href="~/Content/timepicker/jquery.timepicker.css" rel="stylesheet" />
<script src="~/Content/timepicker/jquery.timepicker.js"></script>*@
<script src="~/Content/plupload/jquery-1.10.2.min.js"></script>
<script src="~/Content/UI/js/select-ui.min.js"></script>
<script type="text/javascript">
    $(function () {
        //$('#StartTime').timepicker({
        //    minTime: '7a',
        //    maxTime: '8p',
        //    scrollbar: true,
        //    format: 'hh:ii'
        //});
        //$('#EndTime').timepicker({
        //    minTime: '7a',
        //    maxTime: '8p',
        //    scrollbar: true
        //});
        $(".select3").uedSelect({
            width: 330
        });
    });
</script>
<div class="place">
    <span>位置：</span>
    <ul class="placeul">
        <li><a href="#">首页</a></li>
        <li><a href="#">系统设置</a></li>
    </ul>
</div>
<div class="tools">
    <ul class="toolbar">
        <li class="click" onclick="fnSave()"><span><img src="../Content/UI/images/t02.png" /></span>保存</li>
    </ul>
</div>
<div class="formbody">
    <ul class="forminfo">
        <li>
            <label>上班时间:</label> <input id="StartTime" class="timepicker dfinput" value="@Model.StartTime" style="line-height: 34px" />
        </li>
        <li>
            <label>下班时间:</label> <input id="EndTime" class="timepicker dfinput" value="@Model.EndTime" style="line-height: 34px" />
        </li>
        <li>
            <label>公司名称:</label> <input id="Company" class="dfinput" value="@Model.Company" style="line-height: 34px" />
        </li>
        <li>
            <label>生产装置:</label> <input id="ProductNum" class="dfinput" value="@Model.ProductNum" style="line-height: 34px" />
        </li>
        <li>
            <label>运行套数:</label> <input id="RunNum" class="dfinput" value="@Model.RunNum" style="line-height: 34px" />
        </li>
        <li>
            <label>停用套数:</label> <input id="StopNum" class="dfinput" value="@Model.StopNum" style="line-height: 34px" />
        </li>
        <li>
            <label>检修套数:</label> <input id="RepairNum" class="dfinput" value="@Model.RepairNum" style="line-height: 34px" />
        </li>
        <li>
            <label>特殊动火:</label> <input id="SpecialNum" class="dfinput" value="@Model.SpecialNum" style="line-height: 34px" />
        </li>
        <li>
            <label>一级动火:</label> <input id="OneNum" class="dfinput" value="@Model.OneNum" style="line-height: 34px" />
        </li>
        <li>
            <label>二级动火:</label> <input id="TwoNum" class="dfinput" value="@Model.TwoNum" style="line-height: 34px" />
        </li>
        <li>
            <label> 限制作业:</label> <input id="LimitNum" class="dfinput" value="@Model.LimitNum" style="line-height: 34px" />
        </li>
        <li>
            <label>试生产:</label><cite style="height:32px"><input name="IsTest" style="height:32px" type="radio" value="1" checked="checked" />是&nbsp;&nbsp;&nbsp;&nbsp;<input name="IsTest" style="height:32px" type="radio" value="0" />否</cite>

        </li>
        <li>
            <label>停车状态:</label> <cite style="height:32px"><input name="IsParking" style="height:32px" type="radio" value="1" checked="checked" />是&nbsp;&nbsp;&nbsp;&nbsp;<input name="IsParking" style="height:32px" type="radio" value="0" />否</cite>

        </li>
        <li>
            <label> 负责人名:</label> <input id="ChargeMan" class="dfinput" value="@Model.ChargeMan" style="line-height: 34px" />
        </li>
        <li>
            <label> 系统公告:</label> <input id="Anounce" class="dfinput" value="@Model.Anounce" style="line-height: 34px" />
        </li>
        <li>
            <label>&nbsp;</label>
            <input name="" id="syns-btn" type="button" class="scbtn" value="同步数据" />

            <label>&nbsp;</label>
            <input name="" id="btnSave" type="button" class="scbtn" value="保存数据" />
        </li>
    </ul>
    <input type="hidden" id="Id" value="@Model.Id.ToString()" />
</div>
<script type="text/javascript">
    $(function () {
        $("input[name='IsTest'][value=" + '@Model.IsTest' + "]").attr("checked", true);
        $("input[name='IsParking'][value=" + '@Model.IsParking' + "]").attr("checked", true);
      

        $("#syns-btn").click(function () {
            $.post("../UserInfo/SynsUser", null, function (result) {
                if (result.state == 1) {
                    layer.msg('操作成功');
                }
                else {
                    layer.msg(result.message);
                }

            })
        })
        $("#btnSave").click(function () {
            fnSave();
        })

    })

    function fnSave() {
        $.post('@Url.Action("SaveSystemConfig", "SystemConfig")', queryParams(), function (result) {
            if (result.state == 1) {
                layer.msg('操作成功');
            }
            else {
                layer.msg(result.message);
            }
        })
    }
    function queryParams() {
        return {
            StartTime: $("#StartTime").val(),
            EndTime: $("#EndTime").val(),
            Company: $("#Company").val(),
            ProductNum: $("#ProductNum").val(),
            RunNum: $("#RunNum").val(),
            StopNum: $("#StopNum").val(),
            RepairNum: $("#RepairNum").val(),
            SpecialNum: $("#SpecialNum").val(),
            OneNum: $("#OneNum").val(),
            TwoNum: $("#TwoNum").val(),
            LimitNum: $("#LimitNum").val(),
            IsTest: $("input[name='IsTest']:checked").val(),
            IsParking: $("input[name='IsParking']:checked").val(),
            ChargeMan: $("#ChargeMan").val(),
            Anounce: $("#Anounce").val(),
            Id: $("#Id").val()
        };
    }
</script>
